home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 4808 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.9 KB

  1. Path: newshost.lanl.gov!tanmoy
  2. From: tanmoy@qcd.lanl.gov (Tanmoy Bhattacharya)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: (void(far *)()) 0
  5. Date: 05 Feb 1996 23:29:33 GMT
  6. Organization: Los Alamos National Laboratory
  7. Message-ID: <TANMOY.96Feb5162933@qcd.lanl.gov>
  8. References: <341998718.10858110@magnet.at> <31165B9D.398E@imsisoft.com>
  9. NNTP-Posting-Host: qcd.lanl.gov
  10. Mime-Version: 1.0
  11. Content-Type: text
  12. In-reply-to: Victor Bazarov's message of Mon, 05 Feb 1996 11:33:49 -0800
  13.  
  14. In article <31165B9D.398E@imsisoft.com> Victor Bazarov
  15. <vbazarov@imsisoft.com> writes: 
  16. <snip>
  17.    markus imlinger wrote:
  18.    > 
  19.    > In a C-Programm I saw the instruction:
  20.    > .... = (void(far *)()) 0;
  21.    > 
  22.    > It seems that (void(far *)()) is a cast-
  23.    > operator.
  24.    > 
  25.    > If so this instruction casts 0 to a far-
  26.    > pointer to a function which returns nothing.
  27.  
  28.    And has no parameters.
  29.  
  30. Incorrect. In C, () means an unknown but fixed number of parameters.
  31.  
  32. Of course, with the far in place, it really doesn't mean anything in
  33. ANSI C: so, who knows what the compiler makes of it?
  34.  
  35.    > Now I want to know if my assumption is right and
  36.    > in case it is, what does this mean for 0 ?
  37.  
  38.    Nothing but what you've said -- cast. '0' has type 'int',
  39.    and must be converted into pointer to function in order
  40.    to be properly assigned.
  41.  
  42. More importantly, in this context (assuming the word far is deleted),
  43. 0 is a null pointer constant, which means casting it to a pointer type
  44. results in a null pointer of the appropriate type.
  45.  
  46. Cheers
  47. Tanmoy
  48. --
  49. tanmoy@qcd.lanl.gov(128.165.23.46) DECNET: BETA::"tanmoy@lanl.gov"(1.218=1242)
  50. Tanmoy Bhattacharya O:T-8(MS B285)LANL,NM87545 H:#9,3000,Trinity Drive,NM87544
  51. Others see <gopher://yaleinfo.yale.edu:7700/00/Internet-People/internet-mail>,
  52. <http://alpha.acast.nova.edu/cgi-bin/inmgq.pl>or<ftp://csd4.csd.uwm.edu/pub/
  53. internetwork-mail-guide>. -- <http://nqcd.lanl.gov/people/tanmoy/tanmoy.html>
  54. fax: 1 (505) 665 3003   voice: 1 (505) 665 4733    [ Home: 1 (505) 662 5596 ]
  55.